<?php

// 显示404页
Route::get('notfoundpage', function() {return view('notfound');})->name('notfound');

// 404页返回
Route::get('notfound', function() {return back();})->name('back');

// 显示注册页面路由
Route::get('register', 'Home\HomeRegisterController@ShowRegisterPage')->name('home.register');

// 处理注册信息路由
Route::post('register/doregister', 'Home\HomeRegisterController@DealWithRegister')->name('home.doregister');

// 发送手机验证码路由
Route::post('register/getcode', 'Home\HomeRegisterController@SendPhoneMessage')->name('home.getcode');

// 判断手机号是否已注册
Route::post('register/showphone', 'Home\HomeRegisterController@showphone')->name('home.showphone');

// 判断验证码是否成功
Route::post('register/validata', 'Home\HomeRegisterController@ValidataRegister')->name('home.validata');




// 显示登录页面
Route::get('login', 'Home\HomeLoginController@ShowLoginPage')->name('home.login');

// 验证密码
Route::post('login/valipass', 'Home\HomeLoginController@ValidataPassword')->name('home.valipass');

// 处理登录信息
Route::post('login/dologin', 'Home\HomeLoginController@ValidataLogininfo')->name('home.dologin');

// 发送手机验证码
Route::post('login/loginvalidata', 'Home\HomeLoginController@LoginValidata')->name('home.loginvalidata');

// 判断验证码是否正确
Route::post('login/valicaptcha', 'Home\HomeLoginController@ValidataLogin')->name('home.valicaptcha');

// 处理验证码登录
Route::post('login/phonevalidata', 'Home\HomeLoginController@PhoneCaptchaLogin')->name('home.phonecaptchalogin');

// 退出登录
Route::get('loginout', 'Home\HomeLoginController@LoginOut')->name('loginout')->middleware('homeauth');




// 显示旧密码更改新密码页面
Route::get('beforpass', 'Home\BeForPasswordChangeController@ShowChangePasswordPage')->name('home.beforpass');

// 处理密码更改方法
Route::post('beforpass/dochangepass', 'Home\BeForPasswordChangeController@BeforPasswordCHangePassword')->name('home.beforpasschangepass');;




// 显示更改密码页
Route::get('forgetpassword', 'Home\HomeUserController@ShowForGetPasswordPage')->name('home.forgetpassword')->middleware('homeauth');

// 更改密码短信验证信息发送
Route::post('forgetpassword/changepass', 'Home\ForGetPasswordController@ChangePasswordValidata')->name('home.changepass')->middleware('homeauth');

// 判断用户验证码是否正确
Route::post('forgetpassword/captchavalidata', 'Home\ForGetPasswordController@ValidataChangePass')->name('home.validatachangepass')->middleware('homeauth');

// 处理用户更改密码信息
Route::post('forgetpassword/changepassvalidata', 'Home\ForGetPasswordController@DoChangePassword')->name('home.dochangepass')->middleware('homeauth');





// 显示用户安全页
Route::get('user', 'Home\HomeUserController@HomeUser')->name('home.user')->middleware('homeauth');

// 显示邮箱找回密码页
Route::get('emailgetreturn', 'Home\EmailGetReturnController@EmailGetReturnPage')->name('home.emailgetreturn');

// 邮箱验证码发送
Route::post('getreturnemailcode', 'Home\EmailGetReturnController@SendEmailCode')->name('home.emailcode');

/// 验证邮箱验证码
Route::post('validataemailcode', 'Home\EmailGetReturnController@ValidataGetReturnCode')->name('home.valicode');

// 处理表单提交
Route::post('emailgetreturnform', 'Home\EmailGetReturnController@EmailGetReturnForm')->name('home.doemailgetreturn');

// 绑定邮箱
Route::get('bindemail', 'Home\HomeUserBindEmailController@BindEmail')->name('home.bindemail')->middleware('homeauth');

// 发送邮箱验证码
Route::post('sendemailcode', 'Home\HomeUserBindEmailController@SendEmailCode')->name('home.sendcode')->middleware('homeauth');

// 验证邮箱是否已注册
Route::post('validataemail', 'Home\HomeUserBindEmailController@ValidataEmail')->name('home.validataemail')->middleware('homeauth');

// 邮箱验证码是否正确
Route::post('validataemailcaptcha', 'Home\HomeUserBindEmailController@ValidataEmailCode')->name('home.emailbind')->middleware('homeauth');

// 邮箱表单处理
Route::post('bindemailvalidata', 'Home\HomeUserBindEmailController@DoBindEmail')->name('home.bindemailform')->middleware('homeauth');




// 显示用户地址管理页
Route::get('user/address', 'Home\HomeUserController@ShowAddRessPage')->name('user.address')->middleware('homeauth');

// 处理添加地址
Route::post('user/doaddress', 'Home\UserAddressController@CreateAddress')->name('user.doaddress')->middleware('homeauth');

// 更改地址
Route::post('user/updateaddress', 'Home\UserAddressController@UpdateAddress')->name('user.updateaddress')->middleware('homeauth');

// 删除地址
Route::post('user/delete', 'Home\UserAddressController@DeStroy')->name('user.destroy')->middleware('homeauth');

// 修改默认地址
Route::post('user/defaultaddress', 'Home\UserAddressController@ChangeDefaultAddress')->name('user.changedefault')->middleware('homeauth');



// 显示用户编辑页
Route::get('user/edit', 'Home\HomeUserController@EditUser')->name('user.edit')->middleware('homeauth');

// 处理用户编辑信息
Route::post('user/doedit', 'Home\HomeUserEditController@DoUserEdit')->name('user.doedit')->middleware('homeauth');



// 显示商品详情页面
Route::get('goodsdetail/{id}', 'Home\GoodsDetailController@ShowGoodsDetailPage')->name('goods.goodsdetail');

// 获取对应商品所选中的颜色下的尺寸
Route::post('goodsdetail', 'Home\GoodsDetailController@ShowSize')->name('goods.showsize');

// 求差集
Route::post('poorset', 'Home\GoodsDetailController@PoorSet')->name('goods.poorset');

// 求出该商品详情的库存
Route::post('goodsreserve', 'Home\GoodsDetailController@GetGoodsDetailReserve')->name('goods.goodsreserve');

// 求该详情的id
Route::post('detailinfo', 'Home\GoodsDetailController@GetGoodsDetailInfo')->name('goods.goodsinfo');

// 获取商品介绍
Route::get('goodsdetailpic', 'Home\GoodsDetailController@GoodsDetailPic')->name('goods.pics');
